#include "particle.h"

Particle::Particle(void)
{
	x = 0.0f;
	y = 0.0f;
	memset(&startColor, 0x00, sizeof(GLfloat)*3);
	memset(&endColor, 0x00, sizeof(GLfloat)*3);
	life = 0;
}

Particle::~Particle(void)
{
	/*delete startColor;
	startColor = '\0';
	delete endColor;
	endColor = '\0';*/
}

bool Particle::isAlive(void)
{
	return (life > 0);
}

void Particle::initParticle(GLfloat xx, GLfloat yy, GLfloat sC[3], GLfloat eC[3], unsigned short sLife)
{
	x = xx;
	y = yy;
	startColor = sC;
	endColor = eC;
	life = sLife;
}

void Particle::setBehaviour(GLfloat velX, GLfloat velY, GLfloat accX, GLfloat accY)
{
	velocity = Vector2D(velX, velY);
	accel = Vector2D(accX, accY);
}

void Particle::updateVel(long msec)
{
	velocity = velocity + accel;
	life -= msec;
}

GLfloat Particle::getX(void)
{
	return x;
}

GLfloat Particle::getY(void)
{
	return y;
}
